
/*
 * @Description: 用户登录日志 - 接口
 * @Author: DSY
 * @Date: 2022-11-25 16:15:09
 * @LastEditors: DSY
 * @LastEditTime: 2022-11-25 16:15:09
 */

import { $get, $post, $put, $exportExcel } from '/@/utils/http'
import { ContentTypeEnum } from '/@/constant/http'
import {
  OnlineModel,
  OnlineParams,
  OnlinePageParams,
  OnlinePageResultModel,
  OnlineResultModel
} from './model/onlineModel'

/**
 * 分页查询
 */
export const apiOnlineSearch = (searchParams: OnlinePageParams) =>
  $get<OnlinePageResultModel>({
    url: '/sys/twbOnline/search',
    params: searchParams
  })

/**
 * 根据ID获取详情
 */
export const apiOnlineGetById = (id: string) =>
  $get<OnlineResultModel>({
    url: '/sys/twbOnline/getById',
    params: { id: id }
  })

/**
 * 保存信息
 */
export const apiOnlineSave = (saveParams: OnlineModel) =>
  $post<OnlineResultModel>({
    url: '/sys/twbOnline/save',
    contentType: ContentTypeEnum.json,
    params: saveParams
  })

/**
 * 更新信息
 */
export const apiOnlineUpdateById = (updateParams: OnlineModel) =>
  $put<OnlineResultModel>({
    url: '/sys/twbOnline/updateById',
    contentType: ContentTypeEnum.json,
    params: updateParams
  })

/**
 * 批量删除信息
 */
export const apiOnlineBatchDeleteByIds = (ids: string) =>
  $post<OnlineResultModel>({
    url: '/sys/twbOnline/batchDeleteByIds',
    params: { ids: ids }
  })

/**
 * 导出
 */
 export const apiOnlineExport = (searchParams: OnlineParams, fileName: string) =>
  $exportExcel<OnlineResultModel>(
    {
      url: '/sys/twbOnline/exportExcel',
      params: searchParams
    },
    fileName
  )
